<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./../../Template/generalTemplate.xhtml">


            <ui:define name="content">
                <p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>
                <p:dialog modal="true" widgetVar="statusDialog" header="Generating"   
                          draggable="false" closable="false">  
                    <p:graphicImage value="/images/ajaxloadingbar.gif" />  
                </p:dialog>
                <h:form>
                    <f:view beforePhase="#{manageReceiptManagedBean.initView}">
                        <p:panel id="receipt" header="Receipt Information" style="height:495px;">
                            <p:growl id="growl" showDetail="true" />
                            <p:commandLink style="margin-top:10px; margin-left:900px;" value ="View All Receipt" action="#{manageReceiptManagedBean.viewAll}"/>
                            <hr />
                            <h:panelGrid columns="2" cellpadding ="5" style="margin-left:50px;margin-top:20px;">
                                <h:outputText value="Receipt ID:"/>
                                <h:outputText value="#{manageReceiptManagedBean.receipt.id}"/>
                                <h:outputText value="Issued By:"/>
                                <h:outputText value="#{manageReceiptManagedBean.employeeName}"/>
                                <h:outputText value="Issued Date:"/>
                                <h:outputText value="#{manageReceiptManagedBean.receipt.issuingDate}">
                                    <f:convertDateTime pattern ="dd/MM/yyyy"/>
                                </h:outputText>   
                                <h:outputText value="Issued To:"/>
                                <h:outputText value="#{manageReceiptManagedBean.company.name}"/>
                                <h:outputText value="Amount Paid:"/>
                                <h:outputText value="#{manageReceiptManagedBean.invoice.amountPaid}"/>
                            </h:panelGrid> 
                            <p:commandButton style="margin-top:50px; margin-left:50px;" value="Back" action="#{manageReceiptManagedBean.back}"/>
                            <p:commandButton style="margin-top:50px; margin-left:700px;" update="growl receipt" value="Generate Document" actionListener="#{manageReceiptManagedBean.exportToPDFBySQLConn}"/>
                            <p:commandButton value ="View" ajax="false" rendered="#{manageReceiptManagedBean.view}">
                                <p:fileDownload value="#{manageReceiptManagedBean.file}" contentDisposition="inline"/>
                            </p:commandButton>
                        </p:panel>
                    </f:view>    
                </h:form>    
            </ui:define>


        </ui:composition>

    </body>
</html>
